//
//  TouchDetectingWebViewViewController.m
//  TouchDetectingWebView
//
//  Created by Kishikawa Katsumi on 10/05/05.
//  Copyright Kishikawa Katsumi 2010. All rights reserved.
//

#import "TouchDetectingWebViewViewController.h"
#import "TouchDetectingWindow.h"

@implementation TouchDetectingWebViewViewController

@synthesize webView;

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.yahoo.co.jp"]]];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    TouchDetectingWindow *keyWindow = (TouchDetectingWindow *)self.view.window;
    keyWindow.viewToObserve = webView;
    keyWindow.touchDelegate = self;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

- (void)dealloc {
    [webView release];
    [super dealloc];
}

- (void)gotTouchesBegan:(CGPoint)touchPoint {
    NSLog(@"%s %@", __func__, NSStringFromCGPoint(touchPoint));
}

- (void)gotTouchesMoved:(CGPoint)touchPoint {
    NSLog(@"%s %@", __func__, NSStringFromCGPoint(touchPoint));
}

- (void)gotTouchesEnded:(CGPoint)touchPoint {
    NSLog(@"%s %@", __func__, NSStringFromCGPoint(touchPoint));
}

@end
